<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Usuario
 *
 * @author Jose Tejada
 */
class UsuarioBean extends EntityBean {

    private $m_iIdUsuario;
    private $m_usuarioTipoBean;
    private $m_sNombre;
    private $m_sApPaterno;
    private $m_sApMaterno;
    private $m_dtFechaNac;
    private $m_sDni;
    private $m_sTlfFijo;
    private $m_sTlfCelular;
    private $m_sSexo;
    private $m_sEmail;
    private $m_sUsername;
    private $m_sPassword;
    private $m_sFoto;
    private $m_iHabilitado;
    private $m_iActivo;
    private $m_aoTodos;

    function __construct( $iIdUsuario = 0, UsuarioTipoBean $usuarioTipoBean = NULL, $sNombre = "", $sApPaterno = "", $sApMaterno = "", $dtFechaNac = NULL, $sDni = ""
    , $sTlfFijo = "", $sTlfCelular = "", $sSexo = "", $sEmail = "", $sUsername = "", $sPassword = "", $sFoto = "", $iHabilitado = 0, $iActivo = 0 ) {
        $this->m_iIdUsuario = $iIdUsuario;
        $this->m_usuarioTipoBean = $usuarioTipoBean;
        $this->m_sNombre = $sNombre;
        $this->m_sApPaterno = $sApPaterno;
        $this->m_sApMaterno = $sApMaterno;
        $this->m_dtFechaNac = $dtFechaNac;
        $this->m_sDni = $sDni;
        $this->m_sTlfFijo = $sTlfFijo;
        $this->m_sTlfCelular = $sTlfCelular;
        $this->m_sSexo = $sSexo;
        $this->m_sEmail = $sEmail;
        $this->m_sUsername = $sUsername;
        $this->m_sPassword = $sPassword;
        $this->m_sFoto = $sFoto;
        $this->m_iHabilitado = $iHabilitado;
        $this->m_iActivo = $iActivo;
    }

    public static function cast( UsuarioBean $usuario ) {
        return $usuario;
    }

    public static function returnJSONString( UsuarioBean $user ) {
        $sJsonUser = "{";
        $sJsonUser .= "\"iIdUsuario\":\"" . $user->getIdUsuario() . "\",";
        $sJsonUser .= "\"iTipoUsuario\":\"" . $user->getUsuarioTipoBean()->getIdUsuarioTipo() . "\",";
        $sJsonUser .= "\"sNombre\":\"" . $user->getNombre() . "\",";
        $sJsonUser .= "\"sApPaterno\":\"" . $user->getApPaterno() . "\",";
        $sJsonUser .= "\"sApMaterno\":\"" . $user->getApMaterno() . "\",";
        $sJsonUser .= "\"sFechaNac\":\"" . $user->getFechaNac() . "\",";
        $sJsonUser .= "\"sDni\":\"" . $user->getDni() . "\",";
        $sJsonUser .= "\"sTlfFijo\":\"" . $user->getTlfFijo() . "\",";
        $sJsonUser .= "\"sTlfCelular\":\"" . $user->getTlfCelular() . "\",";
        $sJsonUser .= "\"sSexo\":\"" . $user->getSexo() . "\",";
        $sJsonUser .= "\"sEmail\":\"" . $user->getEmail() . "\",";
        $sJsonUser .= "\"sUsername\":\"" . $user->getUsername() . "\",";
        $sJsonUser .= "\"sPassword\":\"" . sha1( $user->getPassword() ) . "\",";
        $sJsonUser .= "\"iHabilitado\":\"" . $user->getHabilitado(). "\"";
        $sJsonUser .= "}";
        return $sJsonUser;
    }

    public static function returnBasicJSONString( UsuarioBean $user ) {
        $sJsonUser = "{";
        $sJsonUser .= "\"iIdUsuario\":\"" . $user->getIdUsuario() . "\",";
        $sJsonUser .= "\"iTipoUsuario\":\"" . $user->getUsuarioTipoBean()->getIdUsuarioTipo() . "\",";
        $sJsonUser .= "\"sTipoUsuario\":\"" . $user->getUsuarioTipoBean()->getDescUsuarioTipo() . "\",";
        $sJsonUser .= "\"sNombre\":\"" . $user->getNombre() . "\",";
        $sJsonUser .= "\"sApPaterno\":\"" . $user->getApPaterno() . "\",";
        $sJsonUser .= "\"sApMaterno\":\"" . $user->getApMaterno() . "\",";
        $sJsonUser .= "\"sSexo\":\"" . $user->getSexo() . "\",";
        $sJsonUser .= "\"sDni\":\"" . $user->getDni() . "\",";
        $sJsonUser .= "\"sUsername\":\"" . $user->getUsername() . "\",";
        $sJsonUser .= "\"iHabilitado\":\"" . $user->getHabilitado(). "\"";
        $sJsonUser .= "}";
        return $sJsonUser;
    }

    public function getIdUsuario() {
        return $this->m_iIdUsuario;
    }

    public function setIdUsuario( $iIdUsuario ) {
        $this->m_iIdUsuario = $iIdUsuario;
        return $this;
    }

    public function getUsuarioTipoBean() {
        return $this->m_usuarioTipoBean;
    }

    public function setUsuarioTipoBean( UsuarioTipoBean $usuarioTipoBean ) {
        $this->m_usuarioTipoBean = $usuarioTipoBean;
        return $this;
    }

    public function getNombre() {
        return $this->m_sNombre;
    }

    public function setNombre( $sNombre ) {
        $this->m_sNombre = $sNombre;
        return $this;
    }

    public function getApPaterno() {
        return $this->m_sApPaterno;
    }

    public function setApPaterno( $sApPaterno ) {
        $this->m_sApPaterno = $sApPaterno;
        return $this;
    }

    public function getApMaterno() {
        return $this->m_sApMaterno;
    }

    public function setApMaterno( $sApMaterno ) {
        $this->m_sApMaterno = $sApMaterno;
        return $this;
    }

    public function getFechaNac() {
        return $this->m_dtFechaNac;
    }

    public function setFechaNac( $dtFechaNac ) {
        $this->m_dtFechaNac = $dtFechaNac;
        return $this;
    }

    public function getDni() {
        return $this->m_sDni;
    }

    public function setDni( $sDni ) {
        $this->m_sDni = $sDni;
        return $this;
    }

    public function getTlfFijo() {
        return $this->m_sTlfFijo;
    }

    public function setTlfFijo( $sTlfFijo ) {
        $this->m_sTlfFijo = $sTlfFijo;
        return $this;
    }

    public function getTlfCelular() {
        return $this->m_sTlfCelular;
    }

    public function setTlfCelular( $sTlfCelular ) {
        $this->m_sTlfCelular = $sTlfCelular;
        return $this;
    }

    public function getSexo() {
        return $this->m_sSexo;
    }

    public function setSexo( $sSexo ) {
        $this->m_sSexo = $sSexo;
        return $this;
    }

    public function getEmail() {
        return $this->m_sEmail;
    }

    public function setEmail( $sEmail ) {
        $this->m_sEmail = $sEmail;
        return $this;
    }

    public function getUsername() {
        return $this->m_sUsername;
    }

    public function setUsername( $sUsername ) {
        $this->m_sUsername = $sUsername;
        return $this;
    }

    public function getPassword() {
        return $this->m_sPassword;
    }

    public function setPassword( $sPassword ) {
        $this->m_sPassword = $sPassword;
        return $this;
    }

    public function getFoto() {
        return $this->m_sFoto;
    }

    public function setFoto( $sFoto ) {
        $this->m_sFoto = $sFoto;
        return $this;
    }

    public function getHabilitado() {
        return $this->m_iHabilitado;
    }

    public function setHabilitado( $iHabilitado ) {
        $this->m_iHabilitado = $iHabilitado;
    }

    public function getActivo() {
        return $this->m_iActivo;
    }

    public function setActivo( $iActivo ) {
        $this->m_iActivo = $iActivo;
        return $this;
    }

    public function getTodosValores() {
        $this->m_aoTodos = Array(
            $this->m_iIdUsuario,
            $this->m_usuarioTipoBean->getIdUsuarioTipo(),
            $this->m_sNombre,
            $this->m_sApPaterno,
            $this->m_sApMaterno,
            $this->m_dtFechaNac,
            $this->m_sDni,
            $this->m_sTlfFijo,
            $this->m_sTlfCelular,
            $this->m_sSexo,
            $this->m_sEmail,
            $this->m_sUsername,
            $this->m_sPassword,
            $this->m_sFoto,
            $this->m_iHabilitado,
            $this->m_iActivo
        );
        return $this->m_aoTodos;
    }

}

?>
